home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Apps / DevTools / ClassEditor.0.4 / Source / CEBrowserCell.m < prev    next >
Encoding:
Text File  |  1995-06-05  |  2.3 KB  |  114 lines

  1. /* CEBrowserCell.m                 
  2.  *
  3.  * This object controls the data of a beaker (molecules, cameras, groups etc.)
  4.  * It is the main document of BeakerBoy and controls everything from loading to
  5.  * setting up the browser which does most of the other work.
  6.  *
  7.  * For interface-info see the header file. The comments in this file mostly
  8.  * cover only the real implementation details.
  9.  *
  10.  * Written by:         Thomas Engel
  11.  * Created:            23.10.1993 (Copyleft)
  12.  * Last modified:     12.11.1994
  13.  */
  14.  
  15. #define CURRENT_VERSION 1
  16.  
  17. #import <CEBrowserCell.h>
  18.  
  19. @implementation CEBrowserCell
  20.  
  21. + initialize
  22. {
  23.     if ( self == [CEBrowserCell class] )
  24.         [CEBrowserCell setVersion:CURRENT_VERSION];
  25.  
  26.     return self;
  27. }
  28.  
  29. - free
  30. {
  31.     // Don't free the objects...we might need them.
  32.     
  33.     [dragSources free];
  34.     return self;
  35. }
  36.  
  37. - mouseDown:(NXEvent *)theEvent forView:aView
  38. {
  39.     id    dragSource;
  40.     id  dragPB;
  41.     NXPoint    zero = { 0.0, 0.0 };
  42.     NXPoint    theSpot;
  43.     
  44.     // Only continue if there is someone who will handle the drags !
  45.     
  46.     if( [dragSources count] < 1 ) return self;
  47.     
  48.     dragPB = [Pasteboard newName:NXDragPboard];
  49.  
  50.     theSpot.x = (theEvent->location).x - 24;
  51.     theSpot.y = (theEvent->location).y - 24;
  52.     [aView convertPoint:&theSpot fromView:nil];
  53.  
  54.     // restrict the dragging on the first tab.
  55.     // BUG: this should be really automatic !!
  56.     
  57.     if( theSpot.x > 18 - 24 ) return self;
  58.     
  59.     dragSource = [dragSources objectAt:0];
  60.     [dragSource prepareDraggingPboard:dragPB];
  61.     
  62.     // The source should normally be the object itself.
  63.     // Butcurrently this is only for finding out about
  64.     // what the drag should be able to do..perhaps this fits better
  65.     // into the cells (= self) responsiblilty.
  66.     
  67.     [aView dragImage:[dragSource dragImage] 
  68.                 at:&theSpot 
  69.                 offset:&zero 
  70.                 event:theEvent    
  71.                 pasteboard:dragPB 
  72.                 source:self 
  73.                 slideBack:NO];        
  74.     
  75.     return nil;    
  76. }
  77.  
  78. - setSource:theObject
  79. {
  80.     source = theObject;
  81.     return self;
  82. }
  83.  
  84. - source
  85. {
  86.     return source;
  87. }
  88.  
  89. - (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
  90. {
  91.     if( isLocal )
  92.         return NX_DragOperationCopy;
  93.     return NX_DragOperationAll;
  94. }
  95.  
  96. - setDraggingSource:anObject at:(unsigned)index
  97. {
  98.     // This is not implemented properly !!
  99.     
  100.     if( !dragSources )
  101.         dragSources = [List new];
  102.     
  103.     [dragSources addObject:anObject];
  104.     return self;
  105. }
  106.  
  107. @end
  108.  
  109. /*
  110.  * History: 13.01.95 Buh
  111.  *            
  112.  *
  113.  * Bugs: - ...
  114.  */